<?php 
    $url = new Url();    
    $controller = Yii::app()->controller->id;
    $action = Yii::app()->controller->action->id;
    $ac = $controller.'-'.$action;              
?>
<?php if($controller != "group"){ ?>
    <div id="left-navbar">

        <img id="avatar" alt="icoldstyle" src="<?php echo Yii::app()->params['urlRs'];?>/images/default_avatar.png">

        <a id="avatarName" href="<?php echo $url->createUrl("user/index"); ?>"><?php echo $data_user['user_fullname']; ?></a>

        <div class="mainFilters filterWrap">

            <a class="eIcon filterEverything activeFilter" href="<?php echo $url->createUrl("user/index"); ?>">Bài viết mới nhất</a>

            <a class="eIcon eIconDirect filterDirect" rel="F_DIRECT" href="<?php echo $url->createUrl("user/index"); ?>">Tin nhắn</a>

            <a class="eIcon eIconStudent filterByStudents" rel="F_BY_STUDENTS" href="<?php echo $url->createUrl("user/index"); ?>">Từ học sinh</a>

            <a class="eIcon eIconWrite filterAssignments" rel="F_ASSIGNMENTS" href="<?php echo $url->createUrl("user/index"); ?>">Bài tập</a>

            <p class="filterWrapBot"></p>
        </div>                     

        <h4><p>        
                <?php if($data_user['user_type'] == 0){ ?>
                    <a id="create-group" href="#join-group-content" rel="facebox" title="Tham gia nhóm">Tham gia</a>
                    <?php }else{ ?>
                    <a id="create-group" href="#groups-editor" rel="facebox" title="Tạo nhóm">Tạo</a>                
                    <?php } ?>
            </p>Nhóm</h4>

        <div class="groups">
            <?php foreach($data_group as $row){ ?>
                <div class="group">
                    <a style="background:#336699" class="hex"></a>
                    <a id="group-1718977" href="<?php echo $url->createUrl("group/index",array("group_id"=>$row['group_id'])); ?>"><?php echo $row['group_name']; ?></a>
                </div>
                <?php } ?>
        </div>                         

        <!--<div class="communities">

            <h4><a href="javcascript:">Danh sách</a>Cộng đồng</h4>

            <ul class="listCommunity">
                <li>
                    <a class="thumb" href="javascript:"><img src="<?php echo Yii::app()->params['urlRs'];?>/images/5_t.png" alt="Hỗ trợ; ?&gt;"></a>
                    <a href="javascript:">Hỗ trợ</a>Cộng đồng
                </li>
            </ul>

        </div>-->

    </div>
    <?php }else{ ?>
    <div id="left-navbar">

        <img src="<?php echo Yii::app()->params['urlRs'];?>/images/default_avatar.png" alt="Le  Linh" id="avatar">

        <a href="<?php echo $url->createUrl("user/index"); ?>" id="avatarName"><?php echo $data_user['user_fullname']; ?></a>        

        <div class="mainFilters">
            <a class="eIcon filterEverything" href="<?php echo $url->createUrl("user/index"); ?>">Bài viết mới nhất</a>

            <a rel="F_DIRECT" class="eIcon eIconDirect filterDirect" href="<?php echo $url->createUrl("user/index"); ?>">Tin nhắn</a>

            <a rel="F_ASSIGNMENTS" class="eIcon eIconWrite filterAssignments" href="<?php echo $url->createUrl("user/index"); ?>">Bài tập</a>

            <a rel="F_BY_TEACHERS" class="eIcon eIconTeacher filterByTeachers" href="<?php echo $url->createUrl("user/index"); ?>">Từ giáo viên</a>

            <p class="filterWrapBot"></p>
        </div>         

        <h4><p><a id="create-group" href="#join-group-content" rel="facebox" title="Tham gia nhóm">Tham gia</a></p>Nhóm</h4>

        <div class="groups">

            <?php foreach($data_group as $row){ ?>
                <div class="group <?php if($row['group_id'] == $_GET['group_id']){echo "filterWrap";} ?> ">
                    <a style="background:#336699" class="hex"></a>
                    <a id="group-1718977" href="<?php echo $url->createUrl("group/index",array("group_id"=>$row['group_id'])); ?>"><?php echo $row['group_name']; ?></a>
                </div>
                <?php } ?>            

        </div>      

        <!--<div class="communities">
            <h4><a href="javcascript:">Danh sách</a>Cộng đồng</h4>

            <ul class="listCommunity">
                <li>
                    <a class="thumb" href="javascript:"><img src="<?php echo Yii::app()->params['urlRs'];?>/images/5_t.png" alt="Hỗ trợ; ?&gt;"></a>
                    <a href="javascript:">Hỗ trợ</a>Cộng đồng
                </li>
            </ul>

        </div>-->                   

    </div>
    <?php
    }
?>


<div id="groups-editor" class="groups-editor" style="display: none;">
    <div class="highlight-management">
        <a href="javascript:">Quan trọng: Tìm hiểu về các tính năng của quản lý nhóm</a>
    </div>
    <div class="separator">
        <label>Tên nhóm:</label>
        <input class="group-name" value="" maxlength="30">        
        <div class="group-name-blank error group_name_error" style="display: none;">&nbsp;</div>
        <div class="clear"></div>        
    </div>
    <div class="separator">
        <label>Lớp:</label>
        <div class="grade-select-container">
            <select class="grade-select">
                <option value="select">[Chọn lớp]</option>
                <?php foreach($data_grade as $row){ ?>
                    <option value="<?php echo $row['grade_id']; ?>"><?php echo $row['grade_name']; ?></option>
                    <?php } ?>
            </select>            
            <div>
                <div class="group-grade-blank error" style="display: none;">You must enter a grade for the group</div>
                <div class="clear"></div>
            </div>
        </div>        
    </div>
    <div class="separator">
        <label>Lĩnh vực:</label>
        <div>
            <select class="subjects grade-subject">
                <option value="select">[Chọn lĩnh vực] </option>
                <?php foreach($data_subject as $row){ ?>
                    <option value="<?php echo $row['sub_id']; ?>"><?php echo $row['sub_name']; ?></option>
                    <?php } ?>
            </select>
        </div>
        <div class="subject-blank error" style="display: none;">You must enter an area for the group</div>
    </div>
    <input class="button send-button" type="button" value="Tạo" onclick="create_group(<?php echo $data_user['user_id']; ?>)">        
    <div class="clear"></div>    
</div>

<div id="join-group-content" style="display: none;">
    <input class="code-input" onfocus="if(this.value=='Mã nhóm') this.value=''" onblur="if(this.value=='') this.value='Mã nhóm'" value="Mã nhóm">
    <input class="button code-button" style="margin-left: 5px" type="button" value="Tham gia" onclick="join_group(<?php echo $data_user['user_id']; ?>)">        
    <div class="join-error code-invalid" style="display: none;">&nbsp;</div>    
</div> 

<?php include "left_bar.js.php" ?>